/*
 * @Author: zxh
 * @Email: 1271027008@qq.com
 * @Date: 2020-03-12 14:07:36
 * @Descripttion: 物料有效期定义
 */

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpParams } from '@angular/common/http';
import { DictionaryManageService } from 'src/app/system-manage/dictionary-manage/dictionary-manage.service';

@Injectable({
  providedIn: 'root'
})
export class MaterialValidityService {

  private materialValidityUrl = '/api/validityConfig'

  constructor(
    private DictionaryManageService:DictionaryManageService,
    private http:HttpClient
  ) { }

  // 获取字典详情
  getMaterialList(data):Observable<any>{
    return this.DictionaryManageService.getDetailAll(data).pipe()
  }

  // 获取物料有效期定义列表
  getValidityList(data):Observable<any>{
    return this.http.get(this.materialValidityUrl,{params:data}).pipe()
  }
  // 新增物料有效期定义
  addValidity(data):Observable<any>{
    return this.http.post(this.materialValidityUrl,data).pipe()
  }
  // 修改物料有效期定义
  editValidity(data):Observable<any>{
    return this.http.put(this.materialValidityUrl,data).pipe()
  }
}
